from selenium import webdriver
from selenium.webdriver.chrome.options import Options
import time

# 配置Chrome下载选项
chrome_options = Options()
chrome_options.add_experimental_option("prefs", {
    "download.default_directory": r"D:\your\save\path",  # 修改为你的保存路径
    "download.prompt_for_download": False,
    "download.directory_upgrade": True,
    "plugins.always_open_pdf_externally": True
})

# 初始化浏览器
driver = webdriver.Chrome(options=chrome_options)

try:
    # 访问目标页面
    driver.get("https://fgk.chinatax.gov.cn/zcfgk/c102416/c5239243/content.html")
    
    # 找到下载按钮并点击
    download_btn = driver.find_element("id", "zwxz")
    download_btn.click()
    
    # 等待下载完成（根据文件大小调整等待时间）
    time.sleep(10)
    
finally:
    driver.quit()